# 初始化文件，创建Flask应用
from flask import Flask
from .views import blue
from .exts import init_exts


def create_app():
    app = Flask(__name__)
    # 注册blue
    app.register_blueprint(blueprint=blue)

    # 配置数据库
    db_uri = 'sqlite:///sqlite3.db'
    app.config['SQLALCHEMY_DATABASE_URI'] = db_uri
    # 关闭追踪数据库修改
    app.config['SQLALCHEMY_TRACK_MODIFICATIONS'] = False
    # 初始化数据库
    init_exts(app=app)


    return app
